if (!sourceId.equals(this.sourceId)) {
this.sourceId = sourceId;
sourceIdBuff = sourceId.getBytes(Charset.forName("UTF-8"));
}
byte[] nodeIdArray = nodeId.getBytes(Charset.forName("UTF-8"));
byte[] attrArray = attribute.getBytes(Charset.forName("UTF-8"));
ByteBuffer buff = ByteBuffer.allocate(4 + streamIdArray.length + // stream
// id
1 + // CMD
4 + sourceIdBuff.length + // source id
8 + // timeId
(4 + nodeIdArray.length) + // nodeId
(4 + attrArray.length) // attribute
);
buff.putInt(streamIdArray.length).put(streamIdArray)
// Stream id
.put((byte) NetStreamConstants.EVENT_DEL_NODE_ATTR)
// CMD
.putInt(sourceIdBuff.length).put(sourceIdBuff).putLong(timeId)
.putInt(nodeIdArray.length).put(nodeIdArray) // nodeId
.putInt(attrArray.length).put(attrArray); // attribute
doSend(buff);
* org.graphstream.stream.AttributeSink#nodeAttributeRemoved(java.lang.String
* , long, java.lang.String, java.lang.String)
*/
public void nodeAttributeRemoved(String sourceId, long timeId,
String nodeId, String attribute) {
if (!sourceId.equals(this.sourceId)) {
this.sourceId = sourceId;
sourceIdBuff = encodeString(sourceId);
}
ByteBuffer nodeBuff = encodeString(nodeId);
ByteBuffer attrBuff = encodeString(attribute);
ByteBuffer buff = ByteBuffer.allocate(
streamBuffer.capacity() + // stream
1 + // CMD
sourceIdBuff.capacity() + // source id
varintSize(timeId) + // timeId
nodeBuff.capacity() + // nodeId
attrBuff.capacity() // attribute
);
streamBuffer.rewind();
sourceIdBuff.rewind();
buff
.put(streamBuffer)
.put((byte) NetStreamConstants.EVENT_DEL_NODE_ATTR)
.put(sourceIdBuff)
.put(encodeUnsignedVarint(timeId))
.put(nodeBuff)
.put(attrBuff);
doSend(buff);